package com.ywz.project.system.controller;

import com.ywz.common.ResultResp;
import com.ywz.project.system.dto.req.EditTenementReq;
import com.ywz.project.system.dto.req.TenementPageReq;
import com.ywz.project.system.service.TenementApiService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 类描述 -> 租户API接口
 *
 * @Author: ywz
 * @Date: 2024/11/14
 */
@RestController
@RequestMapping("/tenement")
public class TenementApiController {
    @Resource
    private TenementApiService tenementApiService;

    /**
     * 方法描述 -> 获取租户信息
     *
     * @Author: ywz
     * @Date: 2024/11/14
     */
    @GetMapping("/getTenementList")
    @ApiOperation(value = "获取租户信息", httpMethod = "GET")
    public ResultResp getTenementList() {
        return tenementApiService.getTenementList();
    }

    /**
     * 方法描述 -> 获取租户分页信息
     *
     * @Author: ywz
     * @Date: 2024/11/15
     */
    @GetMapping("/getTenementPage")
    @ApiOperation(value = "获取租户分页信息", httpMethod = "GET")
    public ResultResp getTenementPage(TenementPageReq req){
        return tenementApiService.getTenementPage(req);
    }

    /**
     * 方法描述 -> 新增、编辑租户信息
     *
     * @param req 新增租户请求参数
     * @Author: ywz
     * @Date: 2024/11/16
     */
    @PostMapping("/editTenement")
    @ApiOperation(value = "新增、编辑租户信息", httpMethod = "POST")
    public ResultResp editTenement(EditTenementReq req){
        return tenementApiService.editTenement(req);
    }

    /**
     * 方法描述 -> 删除租户信息
     *
     * @param ids 租户id
     * @Author: ywz
     * @Date: 2024/11/19
     */
    @DeleteMapping("/removeTenement")
    @ApiOperation(value = "删除租户信息", httpMethod = "DELETE")
    public ResultResp removeTenement(String ids){
        return tenementApiService.removeTenement(ids);
    }
}
